#! /bin/bash

hive  -S -e  "
--==========学生主题报表========
drop table if exists bxg_rpt.student_rpt;
create table if not exists bxg_rpt.student_rpt(
    class_id                        string          comment '班级id',
    class_date                      string          comment '上课日期',
    morning_normal_signin           bigint          comment '上午正常出勤人数',
    morning_normal_signin_rate      decimal(5,2)    comment '上午正常出勤率',
    morning_late_signin             bigint          comment '上午迟到人数',
    morning_late_signin_rate        decimal(5,2)    comment '上午迟到率',
    morning_leave                   bigint          comment '上午请假人数',
    morning_leave_rate              decimal(5,2)    comment '上午请假率',
    morning_absent                  bigint          comment '上午旷课人数',
    morning_absent_rate             decimal(5,2)    comment '上午旷课率',

    afternoon_normal_signin         bigint          comment '下午正常出勤人数',
    afternoon_normal_signin_rate    decimal(5,2)    comment '下午正常出勤率',
    afternoon_late_signin           bigint          comment '下午迟到人数',
    afternoon_late_signin_rate      decimal(5,2)    comment '下午迟到率',
    afternoon_leave                 bigint          comment '下午请假人数',
    afternoon_leave_rate            decimal(5,2)    comment '下午请假率',
    afternoon_absent                bigint          comment '下午旷课人数',
    afternoon_absent_rate           decimal(5,2)    comment '下午旷课率',

    evening_normal_signin           bigint          comment '晚上正常出勤人数',
    evening_normal_signin_rate      decimal(5,2)    comment '晚上正常出勤率',
    evening_late_signin             bigint          comment '晚上迟到人数',
    evening_late_signin_rate        decimal(5,2)    comment '晚上迟到率',
    evening_leave                   bigint          comment '晚上请假人数',
    evening_leave_rate              decimal(5,2)    comment '晚上请假率',
    evening_absent                  bigint          comment '晚上旷课人数',
    evening_absent_rate             decimal(5,2)    comment '晚上旷课率',

    student_count                   bigint          comment '班级在读总人数'
)
row format delimited
fields terminated by '\t'
stored as textfile;

"